import { ISchema, Stringify } from '@formily/vue'
import { IAIModel, IMonitorSet } from './model'
import { IArea } from './overlay'
import { IPosition } from './position'

/**
 * @description 基础信息
 */
interface IKeyObjectBaseInfo {
    lastModifyUser: string
    belongToCountryArea: string
    area?: IArea
    imgList: string[]
    /**
     * @description 是否为固定目标
     */
    isFixedTarget: boolean
    position?: IPosition

    /**
     * @description 是否为面积目标
     */
    isAreaTarget?: boolean

    areaPosition?: IPosition[]
}

/**
 * @description 重点目标
 */
interface IKeyObject {
    id: string
    name: string
    created_time?: string
    last_operator?: string
    last_update_time?: string
    // 目标所属国家
    country?: string
    // catalog?: Pick<ICatalog, 'id' | 'name'>
    parent_id?: string
    parent_name?: string
    icon: string
    /**
     * @title 扩展schema信息
     */
    attrs: any
    hdrs: IHdrsInfo
    loc: number[]
    // relate_model?: IAIModel[]
    monitor_set?: IMonitorSet
}

type AddIKeyObject = Omit<IKeyObject, 'id'>

/**
 * @description 目标分类
 */
interface ICatalog {
    name: string
    id: string
    children: ICatalog[]
    parent_id?: string | null
    parent_name?: string | null
    create_date?: string
    base_info?: IKeyObjectBaseInfo
    extra_schema?: string
    icon?: string
    hdrs?: IHdrsInfo
}

interface ICatalogTree {
    id: string
    children: ICatalogTree[]
    name: string
    type: 'catalog' | 'target'
    parent_id?: string
    parent_name?: string
}

type IAddCatalog = Pick<ICatalog, 'name' | 'parent_name' | 'parent_id' | 'icon'>

type IFcFormItemType =
    | 'input'
    | 'number'
    | 'radio'
    | 'checkbox'
    | 'select'
    | '_switch'
    | 'time'
    | 'date'
    | 'slider'
    | 'rate'
    | 'color'
    | 'cascader'
    | 'upload'
    | 'transfer'
    | 'tree'
    | 'editor'
    | 'datePicker'
type IFcFormLayoutType = 'row' | 'space'

type IFcFormAssistType = 'alert' | 'button' | 'span' | 'divider'

type IHdrsFieldType = '视频' | '音频' | '图片' | '文字' | '其他'

interface IHdrsField {
    $required: boolean
    children: IHdrsField[]
    display: boolean
    field: string
    hidden: boolean
    info: IHdrsFieldType
    on: {}
    options: []
    props: { action: string }
    title: string
    type: IFcFormItemType | IFcFormLayoutType | IFcFormAssistType
    value: string | string[]
    _fc_drag_tag: string
}

interface IHdrsInfo {
    fields: string
    options?: string
}

interface INeoRelation {
    meta: [
        string | null,
        {
            deleted: false
            id: 2
            type: 'node'
        },
    ]
    row: [
        string | null,
        {
            id: '258dd640-51ba-48f9-bcd5-481d4a1d869a'
            name: '目标A'
            parent_name: '知识图谱测试'
        },
    ]
}

export type {
    IKeyObject,
    ICatalog,
    AddIKeyObject,
    IAddCatalog,
    IHdrsField,
    IHdrsFieldType,
    INeoRelation,
    ICatalogTree,
}
